#include <iostream>
#include <stdio.h>
#include "useHead.h"
#include "scriptHead.h"
#include "stringtable.h"
#include "functable.h"
#include "instrStream.h"

int main()
{
    ScriptHeader sh;
    StringTable  st, hst;
    InstrStream  is;
    FuncTable     ft;

    FILE *fp = fopen("oo.xasm", "rb");
    if (fp == NULL) {
        fprintf(stderr, "open file error !\n");
        return 0;
    }

    if (sh.readFile(fp) != 0) {
        fprintf(stderr, "read Head Error!\n");
        return 0;
    }

    sh.dump();

    if (st.readFile(fp) != 0) {
        fprintf(stderr, "read string table Error!\n");
        return 0;
    }

    st.dump();

    if (is.readFile(fp, st) != 0) {
        fprintf(stderr, "read Instrunction stream Error!\n");
        return 0;
    }

    if (ft.readFile(fp) != 0) {
        fprintf(stderr, "read function table Error!\n");
        return 0;
    }

    if (hst.readFile(fp) != 0) {
        fprintf(stderr, "read host api table Error!\n");
        return 0;
    }
    return 0;
}
